const {
  loginConfig,
  authorizeUrl,
  DBKEY
} = require("../config");
const {
  db
} = require("../utils")
const log = require("../utils/log")
const open = require('open');
const inquirer = require("inquirer");
const config = require("../config");

const questions = [{
    type: 'input',
    name: 'domain',
    message: "请输入域名地址,例如:",
    default () {
      return 'https://www.yuque.com/api/v2';
    },
  },
  {
    type: 'input',
    name: 'token',
    message: "请输入token",
    validate(value) {
      if (value.length > 0) {
        return true;
      }
      return 'token 不能为空';
    }
  }

];
module.exports = async function (args) {
  // 判断登陆

  inquirer.prompt(questions).then((answers) => {
    db.setVal(config.DBKEY, answers)
  })
}